#!/usr/bin/env sh

# 确保脚本抛出遇到的错误
set -e

NORMAL=$(tput sgr0)
GREEN=$(tput setaf 2; tput bold)
YELLOW=$(tput setaf 3)
RED=$(tput setaf 1)

function green() {
    echo "$GREEN$*$NORMAL"
}

function red(){
    echo "$RED$*$NORMAL"
}

time=$(date "+%Y-%m-%d %H:%M:%S")
current_branch=$(git rev-parse --abbrev-ref HEAD)
red 'current time => ' $time

git add -A
git commit -m "#update $time"

git push -f git@gitee.com:ideawang/leetcode-algorithm.git

# git checkout master
green 'current branch =>' $current_branch
# if [[ "$current_branch" != 'master' ]]
# then
#     git pull origin master

#     git merge master

#     git commit -m "#update $current_branch $time"

#     git push origin master

#     echo 'push origin master done'
#     # git push
# fi;

